﻿using System;
using System.Linq;
using Apps.IDAL.Flow;
using Apps.Models;
using System.Data;

namespace Apps.DAL.Flow
{
    public partial class Flow_FormContentStepCheckStateRepository
    {
        public Flow_FormContentStepCheckState GetByStepCheckId(string id)
        {
            using (DBContainer db = new DBContainer())
            {
                return db.Flow_FormContentStepCheckState.SingleOrDefault(a => a.StepCheckId == id);
            }
        }

        public IQueryable<Flow_FormContentStepCheckState> GetListByFormIdAndStepID(string stepId, string contentId)
        {
            IQueryable<Flow_FormContentStepCheckState> list = from a in Context.Flow_FormContentStepCheck
                                                         join b in Context.Flow_FormContentStepCheckState
                                                         on a.Id equals b.StepCheckId
                                                         where a.StepId == stepId & a.ContentId == contentId
                                                         orderby b.CreateTime
                                                         select b;
            return list;
        }
    }
}
